<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>module REXML::Functions - rexml: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="module">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-boolean">::boolean</a>
    <li ><a href="#method-c-ceiling">::ceiling</a>
    <li ><a href="#method-c-compare_language">::compare_language</a>
    <li ><a href="#method-c-concat">::concat</a>
    <li ><a href="#method-c-contains">::contains</a>
    <li ><a href="#method-c-context-3D">::context=</a>
    <li ><a href="#method-c-count">::count</a>
    <li ><a href="#method-c-false">::false</a>
    <li ><a href="#method-c-floor">::floor</a>
    <li ><a href="#method-c-get_namespace">::get_namespace</a>
    <li ><a href="#method-c-id">::id</a>
    <li ><a href="#method-c-lang">::lang</a>
    <li ><a href="#method-c-last">::last</a>
    <li ><a href="#method-c-local_name">::local_name</a>
    <li ><a href="#method-c-name">::name</a>
    <li ><a href="#method-c-namespace_context">::namespace_context</a>
    <li ><a href="#method-c-namespace_context-3D">::namespace_context=</a>
    <li ><a href="#method-c-namespace_uri">::namespace_uri</a>
    <li ><a href="#method-c-normalize_space">::normalize_space</a>
    <li ><a href="#method-c-not">::not</a>
    <li ><a href="#method-c-number">::number</a>
    <li ><a href="#method-c-position">::position</a>
    <li ><a href="#method-c-processing_instruction">::processing_instruction</a>
    <li ><a href="#method-c-round">::round</a>
    <li class="calls-super" ><a href="#method-c-send">::send</a>
    <li ><a href="#method-c-singleton_method_added">::singleton_method_added</a>
    <li ><a href="#method-c-starts_with">::starts_with</a>
    <li ><a href="#method-c-string">::string</a>
    <li ><a href="#method-c-string_length">::string_length</a>
    <li ><a href="#method-c-string_value">::string_value</a>
    <li ><a href="#method-c-substring">::substring</a>
    <li ><a href="#method-c-substring_after">::substring_after</a>
    <li ><a href="#method-c-substring_before">::substring_before</a>
    <li ><a href="#method-c-sum">::sum</a>
    <li ><a href="#method-c-text">::text</a>
    <li ><a href="#method-c-translate">::translate</a>
    <li ><a href="#method-c-true">::true</a>
    <li ><a href="#method-c-variables">::variables</a>
    <li ><a href="#method-c-variables-3D">::variables=</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="module-REXML::Functions">
    <h1 id="module-REXML::Functions" class="module">
      module REXML::Functions
    </h1>

    <section class="description">
    
<p>If you add a method, keep in mind two things: (1) the first argument will always be a list of nodes from which to filter.  In the case of context methods (such as position), the function should return an array with a value for each child in the array. (2) all method calls from XML will have “-” replaced with “_”. Therefore, in XML, “local-name()” is identical (and actually becomes) “local_name()”</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="INTERNAL_METHODS">INTERNAL_METHODS
          <dd>
          <dt id="namespace_context">namespace_context
          <dd>
          <dt id="variables">variables
          <dd>
        </dl>
        </section>



                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-boolean" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">boolean</span><span
                                class="method-args">(object=@@context[:node])</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="boolean-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 318</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">boolean</span>(<span class="ruby-identifier">object</span>=<span class="ruby-identifier">@@context</span>[<span class="ruby-value">:node</span>])
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">object</span>
  <span class="ruby-keyword">when</span> <span class="ruby-keyword">true</span>, <span class="ruby-keyword">false</span>
    <span class="ruby-identifier">object</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Float</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">zero?</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">nan?</span>
    <span class="ruby-keyword">true</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Numeric</span>
    <span class="ruby-keyword">not</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">zero?</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">String</span>
    <span class="ruby-keyword">not</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">empty?</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Array</span>
    <span class="ruby-keyword">not</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">empty?</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">object</span> <span class="ruby-operator">?</span> <span class="ruby-keyword">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ceiling" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ceiling</span><span
                                class="method-args">( number )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="ceiling-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 418</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">ceiling</span>( <span class="ruby-identifier">number</span> )
  <span class="ruby-identifier">number</span>(<span class="ruby-identifier">number</span>).<span class="ruby-identifier">ceil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-compare_language" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">compare_language</span><span
                                class="method-args">(lang1, lang2)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="compare_language-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 371</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">compare_language</span> <span class="ruby-identifier">lang1</span>, <span class="ruby-identifier">lang2</span>
  <span class="ruby-identifier">lang2</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">lang1</span>.<span class="ruby-identifier">downcase</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-concat" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">concat</span><span
                                class="method-args">( *objects )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="concat-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 190</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">concat</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">objects</span> )
  <span class="ruby-identifier">concatenated</span> = <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-identifier">objects</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">object</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">concatenated</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">string</span>(<span class="ruby-identifier">object</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">concatenated</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-contains" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">contains</span><span
                                class="method-args">( string, test )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fixed by Mike Stok</p>

                              <div class="method-source-code" id="contains-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 204</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">contains</span>( <span class="ruby-identifier">string</span>, <span class="ruby-identifier">test</span> )
  <span class="ruby-identifier">string</span>(<span class="ruby-identifier">string</span>).<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">string</span>(<span class="ruby-identifier">test</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-context-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">context=</span><span
                                class="method-args">(value)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="context-3D-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 38</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">context=</span>(<span class="ruby-identifier">value</span>); <span class="ruby-identifier">@@context</span> = <span class="ruby-identifier">value</span>; <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-count" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">count</span><span
                                class="method-args">( node_set )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the size of the given list of nodes.</p>

                              <div class="method-source-code" id="count-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 60</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">count</span>( <span class="ruby-identifier">node_set</span> )
  <span class="ruby-identifier">node_set</span>.<span class="ruby-identifier">size</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-false" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">false</span><span
                                class="method-args">( )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>UNTESTED</p>

                              <div class="method-source-code" id="false-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 348</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-keyword">false</span>(  )
  <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-floor" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">floor</span><span
                                class="method-args">( number )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="floor-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 414</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">floor</span>( <span class="ruby-identifier">number</span> )
  <span class="ruby-identifier">number</span>(<span class="ruby-identifier">number</span>).<span class="ruby-identifier">floor</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-get_namespace" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_namespace</span><span
                                class="method-args">( node_set = nil ) { |context| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Helper method.</p>

                              <div class="method-source-code" id="get_namespace-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 87</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">get_namespace</span>( <span class="ruby-identifier">node_set</span> = <span class="ruby-keyword">nil</span> )
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">node_set</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>
    <span class="ruby-keyword">yield</span> <span class="ruby-identifier">@@context</span>[<span class="ruby-value">:node</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">@@context</span>[<span class="ruby-value">:node</span>].<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:namespace</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">node_set</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-value">:each</span>
      <span class="ruby-identifier">result</span> = []
      <span class="ruby-identifier">node_set</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">node</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword">yield</span>(<span class="ruby-identifier">node</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:namespace</span>)
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">result</span>
    <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">node_set</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-value">:namespace</span>
      <span class="ruby-keyword">yield</span> <span class="ruby-identifier">node_set</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-id" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">id</span><span
                                class="method-args">( object )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Since <a href="../REXML.html"><code>REXML</code></a> is non-validating, this method is not implemented as it requires a <a href="DTD.html"><code>DTD</code></a></p>

                              <div class="method-source-code" id="id-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 66</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">id</span>( <span class="ruby-identifier">object</span> )
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-lang" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">lang</span><span
                                class="method-args">( language )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>UNTESTED</p>

                              <div class="method-source-code" id="lang-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 353</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">lang</span>( <span class="ruby-identifier">language</span> )
  <span class="ruby-identifier">lang</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-identifier">node</span> = <span class="ruby-identifier">@@context</span>[<span class="ruby-value">:node</span>]
  <span class="ruby-identifier">attr</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">until</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">nil?</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">node_type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:element</span>
      <span class="ruby-identifier">attr</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-string">&quot;xml:lang&quot;</span>]
      <span class="ruby-keyword">unless</span> <span class="ruby-identifier">attr</span>.<span class="ruby-identifier">nil?</span>
        <span class="ruby-identifier">lang</span> = <span class="ruby-identifier">compare_language</span>(<span class="ruby-identifier">string</span>(<span class="ruby-identifier">language</span>), <span class="ruby-identifier">attr</span>)
        <span class="ruby-keyword">break</span>
      <span class="ruby-keyword">else</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">node</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">parent</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">lang</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-last" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">last</span><span
                                class="method-args">( )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the last node of the given list of nodes.</p>

                              <div class="method-source-code" id="last-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 51</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">last</span>( )
  <span class="ruby-identifier">@@context</span>[<span class="ruby-value">:size</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-local_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">local_name</span><span
                                class="method-args">(node_set=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="local_name-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 69</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">local_name</span>(<span class="ruby-identifier">node_set</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">get_namespace</span>(<span class="ruby-identifier">node_set</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">node</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">local_name</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-string">&quot;&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">name</span><span
                                class="method-args">( node_set=nil )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="name-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 80</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">name</span>( <span class="ruby-identifier">node_set</span>=<span class="ruby-keyword">nil</span> )
  <span class="ruby-identifier">get_namespace</span>( <span class="ruby-identifier">node_set</span> ) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">node</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">node</span>.<span class="ruby-identifier">expanded_name</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-namespace_context" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">namespace_context</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="namespace_context-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 35</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">namespace_context</span> ; <span class="ruby-identifier">@@namespace_context</span> ; <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-namespace_context-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">namespace_context=</span><span
                                class="method-args">(x)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="namespace_context-3D-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 33</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">namespace_context=</span>(<span class="ruby-identifier">x</span>) ; <span class="ruby-identifier">@@namespace_context</span>=<span class="ruby-identifier">x</span> ; <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-namespace_uri" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">namespace_uri</span><span
                                class="method-args">( node_set=nil )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="namespace_uri-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 76</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">namespace_uri</span>( <span class="ruby-identifier">node_set</span>=<span class="ruby-keyword">nil</span> )
  <span class="ruby-identifier">get_namespace</span>( <span class="ruby-identifier">node_set</span> ) {<span class="ruby-operator">|</span><span class="ruby-identifier">node</span><span class="ruby-operator">|</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">namespace</span>}
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-normalize_space" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">normalize_space</span><span
                                class="method-args">( string=nil )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>UNTESTED</p>

                              <div class="method-source-code" id="normalize_space-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 266</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">normalize_space</span>( <span class="ruby-identifier">string</span>=<span class="ruby-keyword">nil</span> )
  <span class="ruby-identifier">string</span> = <span class="ruby-identifier">string</span>(<span class="ruby-identifier">@@context</span>[<span class="ruby-value">:node</span>]) <span class="ruby-keyword">if</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">nil?</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Array</span>
    <span class="ruby-identifier">string</span>.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\s+/um</span>, <span class="ruby-string">&#39; &#39;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">string</span>}
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">string</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\s+/um</span>, <span class="ruby-string">&#39; &#39;</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-not" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">not</span><span
                                class="method-args">( object )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>UNTESTED</p>

                              <div class="method-source-code" id="not-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 338</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-keyword">not</span>( <span class="ruby-identifier ruby-title">object</span> )
  <span class="ruby-keyword">not</span> <span class="ruby-identifier">boolean</span>( <span class="ruby-identifier">object</span> )
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-number" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">number</span><span
                                class="method-args">(object=@@context[:node])</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>a string that consists of optional whitespace followed by an optional minus sign followed by a Number followed by whitespace is converted to the IEEE 754 number that is nearest (according to the IEEE 754 round-to-nearest rule) to the mathematical value represented by the string; any other string is converted to NaN</p>

<p>boolean true is converted to 1; boolean false is converted to 0</p>

<p>a node-set is first converted to a string as if by a call to the string function and then converted in the same way as a string argument</p>

<p>an object of a type other than the four basic types is converted to a number in a way that is dependent on that type</p>

                              <div class="method-source-code" id="number-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 388</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">number</span>(<span class="ruby-identifier">object</span>=<span class="ruby-identifier">@@context</span>[<span class="ruby-value">:node</span>])
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">object</span>
  <span class="ruby-keyword">when</span> <span class="ruby-keyword">true</span>
    <span class="ruby-constant">Float</span>(<span class="ruby-value">1</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-keyword">false</span>
    <span class="ruby-constant">Float</span>(<span class="ruby-value">0</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Array</span>
    <span class="ruby-identifier">number</span>(<span class="ruby-identifier">string</span>(<span class="ruby-identifier">object</span>))
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Numeric</span>
    <span class="ruby-identifier">object</span>.<span class="ruby-identifier">to_f</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">str</span> = <span class="ruby-identifier">string</span>(<span class="ruby-identifier">object</span>)
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">str</span>.<span class="ruby-identifier">strip</span>
    <span class="ruby-keyword">when</span> <span class="ruby-regexp">/\A\s*(-?(?:\d+(?:\.\d*)?|\.\d+))\s*\z/</span>
      <span class="ruby-node">$1</span>.<span class="ruby-identifier">to_f</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-constant">Float</span><span class="ruby-operator">::</span><span class="ruby-constant">NAN</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-position" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">position</span><span
                                class="method-args">( )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="position-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 55</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">position</span>( )
  <span class="ruby-identifier">@@context</span>[<span class="ruby-value">:index</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-processing_instruction" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">processing_instruction</span><span
                                class="method-args">( node )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="processing_instruction-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 433</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">processing_instruction</span>( <span class="ruby-identifier">node</span> )
  <span class="ruby-identifier">node</span>.<span class="ruby-identifier">node_type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:processing_instruction</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-round" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">round</span><span
                                class="method-args">( number )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="round-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 422</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">round</span>( <span class="ruby-identifier">number</span> )
  <span class="ruby-identifier">number</span> = <span class="ruby-identifier">number</span>(<span class="ruby-identifier">number</span>)
  <span class="ruby-keyword">begin</span>
    <span class="ruby-identifier">neg</span> = <span class="ruby-identifier">number</span>.<span class="ruby-identifier">negative?</span>
    <span class="ruby-identifier">number</span> = <span class="ruby-identifier">number</span>.<span class="ruby-identifier">abs</span>.<span class="ruby-identifier">round</span>
    <span class="ruby-identifier">neg</span> <span class="ruby-operator">?</span> <span class="ruby-operator">-</span><span class="ruby-identifier">number</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">number</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">FloatDomainError</span>
    <span class="ruby-identifier">number</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-send" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">send</span><span
                                class="method-args">(name, *args)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              
                                <div class="method-calls-super">
                                  Calls superclass method
                                  
                              </div>

                              <div class="method-source-code" id="send-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 437</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">send</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">@@available_functions</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>]
    <span class="ruby-keyword">super</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-comment"># TODO: Maybe, this is not XPath spec behavior.</span>
    <span class="ruby-comment"># This behavior must be reconsidered.</span>
    <span class="ruby-constant">XPath</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">@@context</span>[<span class="ruby-value">:node</span>], <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-singleton_method_added" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">singleton_method_added</span><span
                                class="method-args">(name)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="singleton_method_added-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 26</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">singleton_method_added</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">unless</span> <span class="ruby-constant">INTERNAL_METHODS</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">name</span>)
    <span class="ruby-identifier">@@available_functions</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-keyword">true</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-starts_with" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">starts_with</span><span
                                class="method-args">( string, test )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fixed by Mike Stok</p>

                              <div class="method-source-code" id="starts_with-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 199</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">starts_with</span>( <span class="ruby-identifier">string</span>, <span class="ruby-identifier">test</span> )
  <span class="ruby-identifier">string</span>(<span class="ruby-identifier">string</span>).<span class="ruby-identifier">index</span>(<span class="ruby-identifier">string</span>(<span class="ruby-identifier">test</span>)) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-string" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">string</span><span
                                class="method-args">( object=@@context[:node] )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>A node-set is converted to a string by returning the string-value of the node in the node-set that is first in document order. If the node-set is empty, an empty string is returned.</p>

<p>A number is converted to a string as follows</p>

<p>NaN is converted to the string NaN</p>

<p>positive zero is converted to the string 0</p>

<p>negative zero is converted to the string 0</p>

<p>positive infinity is converted to the string Infinity</p>

<p>negative infinity is converted to the string -Infinity</p>

<p>if the number is an integer, the number is represented in decimal form as a Number with no decimal point and no leading zeros, preceded by a minus sign (-) if the number is negative</p>

<p>otherwise, the number is represented in decimal form as a Number including a decimal point with at least one digit before the decimal point and at least one digit after the decimal point, preceded by a minus sign (-) if the number is negative; there must be no leading zeros before the decimal point apart possibly from the one required digit immediately before the decimal point; beyond the one required digit after the decimal point there must be as many, but only as many, more digits as are needed to uniquely distinguish the number from all other IEEE 754 numeric values.</p>

<p>The boolean false value is converted to the string false. The boolean true value is converted to the string true.</p>

<p>An object of a type other than the four basic types is converted to a string in a way that is dependent on that type.</p>

                              <div class="method-source-code" id="string-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 138</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">string</span>( <span class="ruby-identifier">object</span>=<span class="ruby-identifier">@@context</span>[<span class="ruby-value">:node</span>] )
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:node_type</span>)
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">node_type</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:attribute</span>
      <span class="ruby-identifier">object</span>.<span class="ruby-identifier">value</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:element</span>
      <span class="ruby-identifier">string_value</span>(<span class="ruby-identifier">object</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-value">:document</span>
      <span class="ruby-identifier">string_value</span>(<span class="ruby-identifier">object</span>.<span class="ruby-identifier">root</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-value">:processing_instruction</span>
      <span class="ruby-identifier">object</span>.<span class="ruby-identifier">content</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">object</span>.<span class="ruby-identifier">to_s</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">object</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Array</span>
      <span class="ruby-identifier">string</span>(<span class="ruby-identifier">object</span>[<span class="ruby-value">0</span>])
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Float</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">nan?</span>
        <span class="ruby-string">&quot;NaN&quot;</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">integer</span> = <span class="ruby-identifier">object</span>.<span class="ruby-identifier">to_i</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">object</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">integer</span>
          <span class="ruby-string">&quot;%d&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">integer</span>
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">object</span>.<span class="ruby-identifier">to_s</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">object</span>.<span class="ruby-identifier">to_s</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-string_length" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">string_length</span><span
                                class="method-args">( string )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>UNTESTED</p>

                              <div class="method-source-code" id="string_length-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 261</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">string_length</span>( <span class="ruby-identifier">string</span> )
  <span class="ruby-identifier">string</span>(<span class="ruby-identifier">string</span>).<span class="ruby-identifier">length</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-string_value" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">string_value</span><span
                                class="method-args">( o )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>A node-set is converted to a string by returning the concatenation of the string-value of each of the children of the node in the node-set that is first in document order. If the node-set is empty, an empty string is returned.</p>

                              <div class="method-source-code" id="string_value-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 178</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">string_value</span>( <span class="ruby-identifier">o</span> )
  <span class="ruby-identifier">rv</span> = <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-identifier">o</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">node_type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:text</span>
      <span class="ruby-identifier">rv</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_s</span>
    <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">node_type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:element</span>
      <span class="ruby-identifier">rv</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">string_value</span>( <span class="ruby-identifier">e</span> )
    <span class="ruby-keyword">end</span>
  }
  <span class="ruby-identifier">rv</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-substring" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">substring</span><span
                                class="method-args">( string, start, length=nil )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Take equal portions of Mike Stok and Sean Russell; mix vigorously, and pour into a tall, chilled glass.  Serves 10,000.</p>

                              <div class="method-source-code" id="substring-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 228</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">substring</span>( <span class="ruby-identifier">string</span>, <span class="ruby-identifier">start</span>, <span class="ruby-identifier">length</span>=<span class="ruby-keyword">nil</span> )
  <span class="ruby-identifier">ruby_string</span> = <span class="ruby-identifier">string</span>(<span class="ruby-identifier">string</span>)
  <span class="ruby-identifier">ruby_length</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">length</span>.<span class="ruby-identifier">nil?</span>
                  <span class="ruby-identifier">ruby_string</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">to_f</span>
                <span class="ruby-keyword">else</span>
                  <span class="ruby-identifier">number</span>(<span class="ruby-identifier">length</span>)
                <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">ruby_start</span> = <span class="ruby-identifier">number</span>(<span class="ruby-identifier">start</span>)

  <span class="ruby-comment"># Handle the special cases</span>
  <span class="ruby-keyword">return</span> <span class="ruby-string">&#39;&#39;</span> <span class="ruby-keyword">if</span> (
    <span class="ruby-identifier">ruby_length</span>.<span class="ruby-identifier">nan?</span> <span class="ruby-keyword">or</span>
    <span class="ruby-identifier">ruby_start</span>.<span class="ruby-identifier">nan?</span> <span class="ruby-keyword">or</span>
    <span class="ruby-identifier">ruby_start</span>.<span class="ruby-identifier">infinite?</span>
  )

  <span class="ruby-identifier">infinite_length</span> = <span class="ruby-identifier">ruby_length</span>.<span class="ruby-identifier">infinite?</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
  <span class="ruby-identifier">ruby_length</span> = <span class="ruby-identifier">ruby_string</span>.<span class="ruby-identifier">length</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">infinite_length</span>

  <span class="ruby-comment"># Now, get the bounds.  The XPath bounds are 1..length; the ruby bounds</span>
  <span class="ruby-comment"># are 0..length.  Therefore, we have to offset the bounds by one.</span>
  <span class="ruby-identifier">ruby_start</span> = <span class="ruby-identifier">round</span>(<span class="ruby-identifier">ruby_start</span>) <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
  <span class="ruby-identifier">ruby_length</span> = <span class="ruby-identifier">round</span>(<span class="ruby-identifier">ruby_length</span>)

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ruby_start</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span>
   <span class="ruby-identifier">ruby_length</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">ruby_start</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">infinite_length</span>
   <span class="ruby-identifier">ruby_start</span> = <span class="ruby-value">0</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">return</span> <span class="ruby-string">&#39;&#39;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">ruby_length</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">0</span>
  <span class="ruby-identifier">ruby_string</span>[<span class="ruby-identifier">ruby_start</span>,<span class="ruby-identifier">ruby_length</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-substring_after" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">substring_after</span><span
                                class="method-args">( string, test )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Kouhei fixed this too</p>

                              <div class="method-source-code" id="substring_after-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 220</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">substring_after</span>( <span class="ruby-identifier">string</span>, <span class="ruby-identifier">test</span> )
  <span class="ruby-identifier">ruby_string</span> = <span class="ruby-identifier">string</span>(<span class="ruby-identifier">string</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-node">$1</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">ruby_string</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/#{test}(.*)/</span>
  <span class="ruby-string">&quot;&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-substring_before" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">substring_before</span><span
                                class="method-args">( string, test )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Kouhei fixed this</p>

                              <div class="method-source-code" id="substring_before-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 209</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">substring_before</span>( <span class="ruby-identifier">string</span>, <span class="ruby-identifier">test</span> )
  <span class="ruby-identifier">ruby_string</span> = <span class="ruby-identifier">string</span>(<span class="ruby-identifier">string</span>)
  <span class="ruby-identifier">ruby_index</span> = <span class="ruby-identifier">ruby_string</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">string</span>(<span class="ruby-identifier">test</span>))
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ruby_index</span>.<span class="ruby-identifier">nil?</span>
    <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">ruby_string</span>[ <span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">ruby_index</span> ]
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-sum" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">sum</span><span
                                class="method-args">( nodes )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="sum-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 409</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">sum</span>( <span class="ruby-identifier">nodes</span> )
  <span class="ruby-identifier">nodes</span> = [<span class="ruby-identifier">nodes</span>] <span class="ruby-keyword">unless</span> <span class="ruby-identifier">nodes</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Array</span>
  <span class="ruby-identifier">nodes</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">r</span>,<span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">number</span>(<span class="ruby-identifier">string</span>(<span class="ruby-identifier">n</span>)) }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-text" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">text</span><span
                                class="method-args">( )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="text-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 40</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">text</span>( )
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">@@context</span>[<span class="ruby-value">:node</span>].<span class="ruby-identifier">node_type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:element</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">@@context</span>[<span class="ruby-value">:node</span>].<span class="ruby-identifier">find_all</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">node_type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:text</span>}.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">value</span>}
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">@@context</span>[<span class="ruby-value">:node</span>].<span class="ruby-identifier">node_type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:text</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">@@context</span>[<span class="ruby-value">:node</span>].<span class="ruby-identifier">value</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-translate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">translate</span><span
                                class="method-args">( string, tr1, tr2 )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>This is entirely Mike Stok’s beast</p>

                              <div class="method-source-code" id="translate-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 276</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">translate</span>( <span class="ruby-identifier">string</span>, <span class="ruby-identifier">tr1</span>, <span class="ruby-identifier">tr2</span> )
  <span class="ruby-identifier">from</span> = <span class="ruby-identifier">string</span>(<span class="ruby-identifier">tr1</span>)
  <span class="ruby-identifier">to</span> = <span class="ruby-identifier">string</span>(<span class="ruby-identifier">tr2</span>)

  <span class="ruby-comment"># the map is our translation table.</span>
  <span class="ruby-comment">#</span>
  <span class="ruby-comment"># if a character occurs more than once in the</span>
  <span class="ruby-comment"># from string then we ignore the second &amp;</span>
  <span class="ruby-comment"># subsequent mappings</span>
  <span class="ruby-comment">#</span>
  <span class="ruby-comment"># if a character maps to nil then we delete it</span>
  <span class="ruby-comment"># in the output.  This happens if the from</span>
  <span class="ruby-comment"># string is longer than the to string</span>
  <span class="ruby-comment">#</span>
  <span class="ruby-comment"># there&#39;s nothing about - or ^ being special in</span>
  <span class="ruby-comment"># http://www.w3.org/TR/xpath#function-translate</span>
  <span class="ruby-comment"># so we don&#39;t build ranges or negated classes</span>

  <span class="ruby-identifier">map</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-value">0</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">from</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">pos</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">from_char</span> = <span class="ruby-identifier">from</span>[<span class="ruby-identifier">pos</span>]
    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">map</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">from_char</span>
      <span class="ruby-identifier">map</span>[<span class="ruby-identifier">from_char</span>] =
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">pos</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">to</span>.<span class="ruby-identifier">length</span>
        <span class="ruby-identifier">to</span>[<span class="ruby-identifier">pos</span>]
      <span class="ruby-keyword">else</span>
        <span class="ruby-keyword">nil</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  }

  <span class="ruby-keyword">if</span> <span class="ruby-string">&#39;&#39;</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-value">:chars</span>
    <span class="ruby-identifier">string</span>(<span class="ruby-identifier">string</span>).<span class="ruby-identifier">chars</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">map</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">c</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">map</span>[<span class="ruby-identifier">c</span>] <span class="ruby-keyword">else</span> <span class="ruby-identifier">c</span> <span class="ruby-keyword">end</span>
    }.<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">join</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">string</span>(<span class="ruby-identifier">string</span>).<span class="ruby-identifier">unpack</span>(<span class="ruby-string">&#39;U*&#39;</span>).<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">map</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">c</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">map</span>[<span class="ruby-identifier">c</span>] <span class="ruby-keyword">else</span> <span class="ruby-identifier">c</span> <span class="ruby-keyword">end</span>
    }.<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">pack</span>(<span class="ruby-string">&#39;U*&#39;</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-true" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">true</span><span
                                class="method-args">( )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>UNTESTED</p>

                              <div class="method-source-code" id="true-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 343</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-keyword">true</span>( )
  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-variables" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">variables</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="variables-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 36</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">variables</span> ; <span class="ruby-identifier">@@variables</span> ; <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-variables-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">variables=</span><span
                                class="method-args">(x)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="variables-3D-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/functions.rb, line 34</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier ruby-title">variables=</span>(<span class="ruby-identifier">x</span>) ; <span class="ruby-identifier">@@variables</span>=<span class="ruby-identifier">x</span> ; <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

